package org.drjava.controller;

import java.util.HashMap;
import java.util.Map;
import lombok.extern.slf4j.Slf4j;
import org.drjava.dao.mapper.master.CallRecordMapper;
import org.drjava.dao.model.master.CallRecord;
import org.drjava.dao.model.slave.Iuser;
import org.drjava.service.CallRecordService;
import org.drjava.service.IuserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

/**
 * /**
 *
 * @author 陈江
 * @version 1.0
 * @email cj@51huadian.cn
 * @date 2017/7/14
 */
@Slf4j
@Api("Test-Con")
@RestController
@RequestMapping(value = "/hd")
public class TestController {

  @Autowired
  private CallRecordService callRecordService;

  @Autowired
  private IuserService iuserService;

  @ApiOperation("test")
  @RequestMapping(value="/hh",method = RequestMethod.GET)
  public Map home(@RequestParam Long recordId, @RequestParam String hostname,@RequestParam String userId) {
    Map map = new HashMap();
    CallRecord cr = callRecordService.getOne(recordId);
    Iuser iuser = iuserService.getOne(hostname,userId);
    if (cr == null) {
      map.put("record", "none");
    } else {
      map.put("record", cr);
    }
    if (iuser == null) {
      map.put("user", "none");
    } else {
      map.put("user", iuser);
    }

    return map;
  }


}